#ifndef ENTRY_H
#define ENTRY_H
#include <iostream>

class Entry
{
    public:

        //date type
        struct Date{
            std::string year;
            std::string month;
            std::string day;
            std::string hour;
            std::string min;
            std::string sec;
        };

        //writer operator for date to standard output
        friend std::ostream& operator<<(std::ostream& s, Date& a){

                std::cout
                    <<a.year<<"."
                    <<a.month<<"."
                    <<a.day<<". "
                    <<a.hour<<":"
                    <<a.min<<":"
                    <<a.sec<<std::endl;
                return s;
        };
         //writer operator for date to string
        friend std::string& operator<<(std::string& s, Date& a){
                s=a.year+a.month+a.day+a.hour+a.min+a.sec;
                return s;
        };

        //constructors, destructor
        Entry(){};
        Entry(char _type, std::string _title, std::string _summary, std::string _text, Date _date):
                type(_type), title(_title), summary(_summary), text(_text), date(_date){};
        virtual ~Entry(){};

        //write entry to standard output
        friend std::ostream& operator<<(std::ostream& s, Entry*& a){
            Entry::Date date;
            std::string type,title,summary,text;

            date=a->getDate();
            title=a->getTitle();
            summary=a->getSummary();
            text=a->getText();
            type=a->getType();

            std::cout<<"Title: "<<title<<std::endl;
            std::cout<<"     -----"<<std::endl;
            if(type!="T"){ std::cout<<"Summary: "<<summary<<std::endl; };
            std::cout<<"Text: "<<text<<std::endl;
            std::cout<<date<<std::endl;
            return s;
        }

        //setters,getters
        void setType(const char _a){type=_a;}
        char getType() const{return type;}
        void setText(const std::string _a){text=_a;}
        std::string getText() const{return text;}
        void setTitle(const std::string _a){title=_a;}
        std::string getTitle() const{return title;}
        void setSummary(const std::string _a){summary=_a;}
        std::string getSummary() const{return summary;}
        void setDate(std::string _a){};
        Date getDate()const{return date;}
    private:
        char type;
        std::string title;
        std::string text;
        std::string summary;
        Date date;
};


//entry types
class Note: public Entry{
    public:
        Note(char _type, std::string _title, std::string _summary, std::string _text, Date _date):
            Entry(_type,_title,_summary,_text,_date){};
};

class Web: public Entry{
    public:
        Web(char _type, std::string _title, std::string _summary, std::string _text, Date _date):
            Entry(_type,_title,_summary,_text,_date){};
};

class Thought : public Entry{
    public:
        Thought(char _type, std::string _title, std::string _summary, std::string _text, Date _date):
            Entry(_type,_title,_summary,_text,_date){};
};

#endif // ENTRY_H
